package collision;

import java.awt.Color;
import java.awt.Font;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;




public class Button
{

	Rectangle r;
	Color c;
	int h;
	int w;
	int x;
	int y;
	String msg ;
	int fontsize;
	boolean clicked;

    /**
     * Initializes a new button with specified parameters.
     */
    public Button(Color col, int px, int py, int width, int height, String s, int fsize) 
    {
    	c = col;
    	h = height;
    	w = width;
    	x = px;
    	y = py;
    	r = new Rectangle();
    	r.setBounds(x, y, w, h);
    	msg = s;
    	fontsize = fsize;
    	clicked = false;

    }
    
    public Color getColor()
    {
    	if(clicked)
    		return c.darker().darker();
    	else
    		return c;
    }
    
    public Font getFont()
    {
    	return new Font("Helvetica", Font.BOLD, fontsize);
    }
    
    public String getLabel()
    {
    	return msg;
    }
    
    public void setLabel(String l)
    {
    	msg = l;
    }
    
    public Rectangle getRect()
    {
    	return r;
    }
    
    public void setClicked(boolean s)
    {
    	clicked = s;
    }
    
    public boolean isClicked()
    {
    	return clicked;
    }



    public void mousePressed(MouseEvent e) 
    {
    	if(r.contains(e.getPoint()))
    		clicked=true;
    }
    
    
         


}
